<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<style>
    #mian{ width: 500px;border: #0000ff 1px solid ;margin: auto}
    .text{width: 400px;margin-left: 150px;}
</style>
<body>
<div id="mian">
    <div class="text">
        <h1>请输入学生信息</h1>
        <p>用户名:${sessionScope.loginUserName}</p>
        <form method="post" onsubmit="return check()" name="registerForm" action="${pageContext.request.contextPath}/ServletMessage?method=insert" >
            姓名:  <input type="text" name="name"><br/><br/>
            性别:  <input type="text" name="sex"><br/><br/>
            生日:  <input type="text" name="birthday"><br/><br/>
            邮箱:  <input type="text" name="emil"><br/><br/>
            电话:  <input type="text" name="phone"><br/><br/>
            备注:  <input type="text" name="comment"><br/><br/>
            &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input  type="submit" value="提交" ><br/>

        </form>
    </div>
</div>
</body>
</html>
<script>
    function check() {

        if (registerForm.name.value == "") {
            alert("姓名必须输入！");
            registerForm.name.focus(); //获得焦点
            return false;
        }
        return true;  //未验证出错误时
    }
</script>